<?php
	
	include_once "inc/defines.php";
	
	$unquoted = array("id_grptp", "id_parcours");
	$id = $_POST["id"];
	$db = new PDO(SERVER.":host=".HOST.";dbname=".BASE, USER, PASS);
	$sqlQuery = "DELETE FROM ".SUIT_TABLE." WHERE id_dde=:id;";
	$st = $db->prepare($sqlQuery);
	$st->bindValue(':id', $id, PDO::PARAM_STR);
	$st->execute();
	unset($_POST["id"]);
	foreach($_POST as $id_form) {
		$sqlQuery = "INSERT INTO ".SUIT_TABLE." VALUES(:id, :form);";
		$st = $db->prepare($sqlQuery);
		$st->bindValue(':id', $id, PDO::PARAM_STR);
		$st->bindValue(':form', $id_form, PDO::PARAM_STR);
		$st->execute();
	}
	header('Location: '.$_SERVER['HTTP_REFERER'], true, 302); //revenir a la page precedante en rafraichissant la page

?>
